package com.doitedu.hbase.client2;

import com.doitedu.hbase.utils.HbaseUtil;
import org.apache.hadoop.hbase.client.*;

import java.util.Iterator;

/**
 * @Date 2021/12/16
 * @Created by HANGGE
 * @Description TODO
 */
public class C02_Filter {
    public static void main(String[] args) throws Exception {
        Connection conn = HbaseUtil.getConnection();
        Table tbl = HbaseUtil.getTable("tb_teacher", conn);
        Scan scan = new Scan();
        //scan.setLimit(2);
        scan.withStartRow("rk002".getBytes()) ;
        scan.withStopRow("rk005".getBytes()) ; //不包含  [ )
        //扫描数据
        ResultScanner scanner = tbl.getScanner(scan);
        Iterator<Result> iterator = scanner.iterator();
        while (iterator.hasNext()){
            Result result = iterator.next();
            HbaseUtil.show(result);
        }

        tbl.close();
        conn.close();

    }
}
